package com.zhengtoudai.ui.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zhengtoudai.R;
import com.zhengtoudai.ui.bean.AccountLog;
import com.zhengtoudai.util.DensityUtil;
import com.zhengtoudai.view.recyclerview.RecyclerViewAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 资金记录列表适配器
 */

public class FundRecordAdapter extends RecyclerViewAdapter<FundRecordAdapter.ViewHolder,AccountLog.ResultEntity.ListEntity> {
    private Context mContext;
    @Override
    public FundRecordAdapter.ViewHolder mOnCreateViewHolder(ViewGroup parent,int viewType) {
        mContext=parent.getContext();
        View view = LayoutInflater.from(mContext).inflate(R.layout.list_item_fund_record, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void mOnBindViewHolder(FundRecordAdapter.ViewHolder holder, int position) {
        if (position==10){
            holder.itemView.setPadding(0,0,0, DensityUtil.dip2px(mContext,10));
        }
        holder.mTvTitle.setText(data.get(position).getTradeCode());
       holder.mTvSum.setText(data.get(position).getDealMoney());
        holder.mTvDate.setText(data.get(position).getAlLogAddTime());
        holder.mTvLei.setText(data.get(position).getTradeCode());
        holder.mTvNotes.setText(data.get(position).getLogRemark());

    }


    static class ViewHolder extends RecyclerView.ViewHolder{
        @Bind(R.id.tv_title)
        TextView mTvTitle;
        @Bind(R.id.tv_sum)
        TextView mTvSum;
        @Bind(R.id.tv_date)
        TextView mTvDate;
        @Bind(R.id.tv_lei)
        TextView mTvLei;
        @Bind(R.id.tv_notes)
        TextView mTvNotes;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
